<link rel="stylesheet" type="text/css" href="${STATIC!}/xadmin/lib/layui/css/layui.css" />
<a
  href="javascript:void(0);"
  class="easyui-linkbutton"
  data-options="iconCls:'eova-icon732',plain:true"
  onclick="singleDeletes()"
  >${button.name!'删除'}</a
>
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="singleDeletes2()"
  >${button.name!'删除'}</button
>
<script type="text/javascript" src="${STATIC!}/xadmin/lib/layui/layui.all.js"></script>
<script type="text/javascript">
  var singleDeletes = function() {
    var $grid = $("#grid")
    var rows = $grid.datagrid("getSelections")
    var num = rows.length //获取要删除信息的个数
    if (num == "0") {
      $.slideMsg($.I18N("请选择一行数据"))
      return
    }
    confirmDel($grid, "${object.code}", rows)
  }
  // 确认删除
  var confirmDel2 = function($widget, objectCode, rows) {
    layer.confirm("确定要删除么？", function(index) {
      //只有当点击confirm框的确定时，该层才会关闭
      var json2 = JSON.stringify(rows)
      $.syncPost(
        "/grid/delete/" + objectCode,
        {
          rows: json2
        },
        function(result, status) {
          if (result.success) {
            layer.msg($.I18N("删除成功"))
            $.widgetReLoad($widget)
          } else {
            layer.msg(result.msg)
          }
        }
      )
      $.widgetClearSelections($widget)
    })
  }
  var singleDeletes2 = function() {
    var $grid = $("#grid")
    var rows = $grid.datagrid("getSelections")
    var num = rows.length //获取要删除信息的个数
    if (num == "0") {
      layer.msg($.I18N("请选择一行数据"))
      return
    }
    confirmDel2($grid, "${object.code}", rows)
  }
</script>
